#!/usr/bin python3
# -*- coding:UTF-8 -*-
# Author: nigo
import pandas as pd
import plotly.graph_objects as go
# 读取数据
dfs = pd.read_excel("agency_info.xlsx",sheet_name="all")
token = '你的token'
# 不重复的机构名称
agencies = dfs['type'].unique()
# 创建空画布
fig = go.Figure()
# 循环给每个机构创建轨迹
for agency in agencies:
    df = dfs[dfs.type==agency]
    trace = go.Scattermapbox(lon=df.lon,
                            lat=df.lat,
                            text=df.type,
                            name = agency,
                           )
    fig.add_traces(trace)
# 更新轨迹 点大小和显示模式(点+文本)
fig.update_traces(marker_size=12,mode="markers+text")
# 更新样式
fig.update_layout(mapbox={"accesstoken":token,
                          'center':{
                              'lon':104.072329,'lat':30.65342,},
                          'style':'light',
                          'zoom':11.8},
                  margin={'l':0,'r':0,'t':20,'b':0},
                 )
# 显示画布
fig.show()
